package com.aaa.service.impl;

import com.aaa.dao.BookDao;
import com.aaa.entity.Book;
import com.aaa.service.BookService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookDao bd;
    @Override
    public PageInfo findBook(String dynName, String docName, String grand, String bookName,
                                String introduce, String memo, int page, int size) {
        PageHelper.startPage(page,size);
        List<Map> list=bd.findBook(dynName,docName,grand,bookName,introduce,memo);
        return new PageInfo(list);
    }

    @Override
    public Map findBookById(int bookId) {
        return bd.findBookById(bookId);
    }

    @Override
    public int updateBook(Book book) {
        return bd.updateBook(book);
    }

    @Override
    public int bookAdd(Book book) {
        return bd.bookAdd(book);
    }

    @Override
    public List<Map> findBookDesc() {
        return bd.findBookDesc();
    }
    public int bookDel(int bookId){
        return bd.bookDel(bookId);
    }

    @Override
    public List<Map> checkBook(String bookName) {
        return bd.checkBook(bookName);
    }

    @Override
    public PageInfo findBookRepeat(int page,int size) {
        PageHelper.startPage(page,size);
        List<Map> list=bd.findBookRepeat();
        return new PageInfo(list);
    }
}
